package net.koodar.forge.system.user.model.dto;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Getter;
import lombok.Setter;
import net.koodar.forge.mybatis.doman.page.AbstractPageQuery;
import net.koodar.forge.system.user.model.entity.User;

/**
 * @author liyc
 */
@Getter
@Setter
public class UserQueryDTO extends AbstractPageQuery<User> {

	private String username;

	private Long departmentId;

	@Override
	public QueryWrapper<User> addQueryCondition() {
		QueryWrapper<User> queryWrapper = Wrappers.query();
		queryWrapper.eq(StrUtil.isNotBlank(username), "username", username);
		queryWrapper.eq(departmentId != null, "department_id", departmentId);
		return queryWrapper;
	}
}
